<template>
  <div class="employee-login">
    <div>
      <form>
        <div>
          <input type="text" placeholder="请输入用户名">
        </div>
        <div>
          <input type="password" placeholder="请输入密码">
        </div>
        <div>
          <button type="button" @click="submit();">提交</button>
        </div>
        <a v-bind:href="url" v-bind:play="play">一条连接</a>
      </form>
    </div>
    <div>
      <button @click="show = !show">Toggle</button>
      <transition name="fade" tag="好">
        <p v-show="show">hello</p>
      </transition>
    </div>
    <div>
      <button @click="changeData();">changedate</button>
      {{ count }} {{ is }}
    </div>
  </div>
</template>

<script>
var is = 'test';

export default {
  name: "Login",
  data() {
    return {
      is: is,
      url:'index',
      play: 'text',
      show: {
        defaul: true
      }
    };
  },
  computed: {
    // 一般computed中的属性只有getter没有setter可以用这种方式设置
    // count: {
    //   // getter
    //   get: function() {
    //     return this.$store.state.count;
    //   },
    //   // setter
    //   set: function(newValue) {
    //     this.$store.state.count = newValue;
    //   }
    // },
    count: function() {
      return this.$store.state.count;
    }
  },
  methods: {
    submit: function() {
      this.$axios.get("/koala/subject/test").then(res => {
        console.log(res);
      });
    },
    changeData: function() {
      this.$store.dispatch("addNumCount", {'a': 11,'b': 12});
      this.show =!this.show;
      // this.count = 2000;
      this.is = 'dev';
    }
  }
};
</script>

<style scoped>
.employee-login {
  width: 100%;
  height: 100%;
}
.fade-enter-active,
.fade-leave-active {
  transition: opacity 1s;
}
.fade-enter,
.fade-leave-active {
  opacity: 0;
}
</style>
